using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using DataTransferObject;
using Business;

namespace Presentation.UserControlls
{
    public partial class UC_SachTrongThuVien : UserControl
    {
        clsSachDTO sachDTO = new clsSachDTO();
        clsSachBUS sachBUS = new clsSachBUS();
        clsThuKhoBUS ThuKhoBUS = new clsThuKhoBUS();

        BindingSource bs = new BindingSource();
        DataTable tbl = new DataTable();
        int tongcong;

        public UC_SachTrongThuVien()
        {
            InitializeComponent();
        }

        private void HienThiListView(DataTable tbl1)
        {
            ListViewItem lvwitem = new ListViewItem();
            lvwthongkesach.Items.Clear();
            foreach (DataRow dr in tbl1.Rows)
            {
                tongcong = tongcong + 1;
                lvwitem = new ListViewItem();
                lvwitem.Text = dr["DKCB"].ToString();
                lvwitem.SubItems.Add(dr["TenTuaSach"].ToString());
                lvwitem.SubItems.Add(dr["TenNN"].ToString());
                lvwitem.SubItems.Add(dr["Gia"].ToString());
                lvwthongkesach.Items.Add(lvwitem);
            }


        }

       

        private void groupPanel1_Click(object sender, EventArgs e)
        {

        }

        private void groupPanel1_Click_1(object sender, EventArgs e)
        {

        }

        private void UC_SachTrongThuVien_Load(object sender, EventArgs e)
        {
            tbl = ThuKhoBUS .ThuKhoThongKeSachTrongThuVien ();

            tongcong = 0;

            HienThiListView(tbl);
            lbltongcong.Text = Convert.ToString(tongcong);
        }

        private void buttonX2_Click(object sender, EventArgs e)
        {
            DialogResult dlg = new DialogResult();
            dlg = DevComponents.DotNetBar.MessageBoxEx.Show("Bạn có muốn thoát không ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dlg == DialogResult.Yes)
            {
                this.ParentForm.Close();

            }
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            FromInAn.FrmThongKeSach TKSach = new Presentation.FromInAn.FrmThongKeSach();
            TKSach.Show();
        }
    }
}
